<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>活动编辑</title>

</head>
  <link rel="stylesheet"
	href="<%=basePath%>kindeditor/themes/default/default.css" />
<link rel="stylesheet"
	href="<%=basePath%>kindeditor/plugins/code/prettify.css" />
<script type="text/javascript"
	src="<%=basePath%>kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="<%=basePath%>kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="<%=basePath%>kindeditor/plugins/code/prettify.js"></script>
<script charset="utf-8"
	src="<%=basePath%>kindeditor/kindeditor-myconfig-org.js"></script>
		<link rel="stylesheet" 	href="<%=basePath%>ui/css/edit.css" />
<script type="text/javascript">
$(function(){
	editor = KindEditor.create('#editer1', {
		  
		  width:'100%',height:'440px',
		 
		   cssPath : '/kindeditor/plugins/code/prettify.css',
		  filterMode:false,
		  
		  uploadJson:'/kindeditor/jsp/upload_json.jsp'
			  ,langType : 'zh_CN',items:KE_simple,resizeType:0
	});
	prettyPrint();
});
	function checkContent() {
		var mesName=$("#mesName").val();
		if(!mesName){
			alert("请输入标题！");
			return false;
		}
	/* 	var file=$("#file").val();
		if(file){
			var type=file.substring(file.lastIndexOf('.')+1,file.length).toLowerCase();
			if(type!='jpg' && type !='gif' && type !='png' && type!='bmp'){
				alert("请上传图片格式附件");
				return false;
			}
		}
		 */
		var content = editor.text();
		if (editor.isEmpty()) {
			alert("请输入内容！");
			return false;
		}
		if (content.length > 20000) {
			alert("内容长度不能超过20000字！");
			return false;
		}
		var content2 = editor.html();
		$("#editer1").val(content2);
		
	/* 	var mesContent=$("#mesContent").val();
		if(!mesContent){
			alert("请输入内容！");
			return false;
		}
		if(mesContent.length>200){
			alert("内容长度超过200字符");
			$("#mesContent").select();
			return false;
		} */
		return true;
	}
</script>
<body >
	<form id="myform" method="post" action="<%=basePath%>message/save.html" onsubmit="return checkContent()" enctype="multipart/form-data">
		<input type="hidden" name="porCode" value="${porCode}"> <input
			type="hidden" name="id" value="${entity.id}">
			<input type="hidden" name="type" value="${type }">
		<table cellspacing="0" cellpadding="0" border="0"  class="addclass">
		 <tr>
	  		    <td colspan="2><div class="nav"><%@ include file="/common/nav.jsp"%></div></tr>
	  		  </tr>
			<tr>
				<td width="20%"  class="trLeft">标题：</td>
				<td><input type="text" name="mesName" id="mesName" value="${entity.mesName}" maxlength="50" ></td>
			</tr>
			<tr>
				<td width="20%"  class="trLeft">是否首页显示：</td>
				<td>
				<c:if test="${empty entity.id }">
				  <input type="radio" name="mesIfreview" value="1" class="otherInput">是
				  <input type="radio" name="mesIfreview" value="0"  class="otherInput" checked="checked">否
				</c:if>
				 <c:if test="${not empty entity.id }">
				  <input type="radio" name="mesIfreview" value="1"   class="otherInput" <c:if test="${entity.mesIfreview ==1}">  checked="checked" </c:if> >是
				  <input type="radio" name="mesIfreview" value="0"  class="otherInput" <c:if test="${entity.mesIfreview ==0}">  checked="checked" </c:if> >否
				 </c:if>
				</td>
			</tr>
			<%-- <tr>
				<td width="20%" class="trLeft" valign="top">背景图片：</td>
				<td><input type="file" name="file" id="file" class="fileInput"><br>
				<input name="mesAccessory" type="hidden" value="${entity.mesAccessory }">
				<c:if test="${not empty entity.mesAccessory}">
				  <img src="<%=uiPath %>${entity.mesAccessory}" width="200" height="132">
				</c:if>
				</td>
			</tr> --%>
			<tr>
				<td valign="top"  class="trLeft">内容：</td>
				<td><textarea id="editer1"  name="mesContent" class="textarea">${entity.mesContent }</textarea></td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center">
				<input type="submit" value="提交" id="save" class="button"></td>
				<!-- onclick="save()" -->
			</tr>
		</table>
	</form>
</body>
</html>
